<div id="sub_nav">
    <nav class="navbar navbar-default" role="navigation">
        <div class="container" style="width:1180px;">
            <if condition="ACTION_NAME eq 'index'">
                <a href="{:U($MODULE_INFO['entry'])}" class="navbar-brand logo" ><i class="icon-{$brand.icon}"></i> <empty name="brand.title" value="" >{$MODULE_ALIAS}<else/>{$brand.title}</empty></a>
                <else/>
                <a href="javascript:void(0);" class="navbar-brand logo" id="top-cats-show">商品分类 <i class="icon-chevron-right"></i></a>
                <div id="top-cats">
                    <include file="Public/_menu_tree"/>
                </div>
                <script>
                    $(function(){
                       $('#top-cats-show').click(function(){
                            if($('#top-cats').is(':visible')){
                                $(this).find('i').removeClass('icon-chevron-down').addClass('icon-chevron-right');
                                $('#top-cats').hide();
                            }else{
                                $(this).find('i').removeClass('icon-chevron-right').addClass('icon-chevron-down');
                                $('#top-cats').show();
                            }
                       });
                    });
                </script>
            </if>
            <div class="container-fluid">
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-7">
                    <ul class="nav navbar-nav">
                        <volist name="menu_list.left" id="menu">
                            <php>$class=($top_tab==$menu['tab'])?'active':'';</php>
                            <if condition="$menu['children']">
                                <!--二级菜单-->
                                <li id="tab_{$menu.tab}" class="dropdown {$class}">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                        <neq name="menu.icon" value=""><i class="icon-{$menu.icon}"></i>
                                        </neq>
                                        {$menu.title} <i class="icon-caret-down"></i>
                                        <ul class="dropdown-menu" role="menu">
                                            <volist name="menu.children" id="child">
                                                <li><a href="{$child.href}" class="{$child.class}">
                                                    <neq name="child.icon" value=""><i
                                                            class="glyphicon glyphicon-{$child.icon}"></i></neq>
                                                    {$child.title}</a></li>
                                            </volist>

                                        </ul>
                                </li>
                                <else/>
                                <!--一级菜单-->
                                <li id="tab_{$menu.tab}"  class="{$class}"
                                        ><a href="{$menu.href}" class="{$menu.a_class}">
                                    <neq name="menu.icon" value=""><i class="glyphicon glyphicon-{$menu.icon}"></i>
                                    </neq>
                                    {$menu.title}</a></li>
                            </if>

                        </volist>
                    </ul>
                    <if condition="$menu_list['right'] neq null">
                        <ul class="nav navbar-nav navbar-right">
                            <volist name="menu_list.right" id="menu">
                                <php>$class=($top_tab==$menu['tab']?'active':'');</php>
                                <switch name="menu.type">
                                    <case value="button">
                                        <a href="{$menu.href}" class="{$menu.a_class} {$class}"><i class="icon-{$menu.icon}"></i>{$menu.html}</a>
                                    </case>
                                    <case value="search">
                                        <form class="navbar-form navbar-right" action="{$menu.action}"  method="{$menu.from_method}" role="search">
                                            <div class="search-input-group">
                                                <button type="submit" class="input-btn" style="border-color: transparent;background: transparent;"><i class="icon-search"></i></button>
                                                <input type="text" class="input" placeholder="{$menu.input_title}" name="{$menu.input_name}" value="{$search_keywords}">
                                            </div>
                                            </span>
                                        </form>
                                    </case>
                                    <default/>
                                    <if condition="$menu['children']">
                                        <!--二级菜单-->
                                        <li id="tab_{$menu.tab}" class="dropdown {$class}">
                                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                                <neq name="menu.icon" value=""><i class="icon-{$menu.icon}"></i>
                                                </neq>
                                                {$menu.title} <i class="icon-caret-down"></i>
                                                <ul class="dropdown-menu" role="menu">
                                                    <volist name="menu.children" id="child">
                                                        <li><a href="{$child.href}" class="{$child.class}">
                                                            <neq name="child.icon" value=""><i
                                                                    class="glyphicon glyphicon-{$child.icon}"></i></neq>
                                                            {$child.title}</a></li>
                                                    </volist>

                                                </ul>
                                        </li>
                                        <else/>
                                        <!--一级菜单-->
                                        <li id="tab_{$menu.tab}" class="{$menu.li_class} {$class}">
                                            <a href="{$menu.href}" class="{$menu.a_class}">
                                                <neq name="menu.icon" value=""><i class="glyphicon glyphicon-{$menu.icon}"></i>
                                                </neq>
                                                {$menu.title}</a></li>
                                    </if>

                                </switch>
                            </volist>
                            <form class="navbar-form navbar-right" action="{:U('store/Index/search')}" method="post" role="search" style="width: 325px;margin: 9px 0;">
                                <input id="ip_type" type="hidden" name="type" value="{$_GET['type']}">
                                <div class="input-group">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                            <span id="search_type_title">
                                            <if condition="$_GET['type'] eq 'goods'">
                                                商品
                                                <else/>
                                                店铺
                                            </if>
                                            </span>
                                            <span class="caret"></span>
                                        </button>
                                        <button type="submit" class="btn btn-default" tabindex="-1"><i class="icon-search" style="font-size: 12px;"></i></button>
                                        <ul class="dropdown-menu" role="menu">
                                            <li><a onclick="setTab('goods')">商品</a></li>
                                            <li><a onclick="setTab('shop')">店铺</a></li>
                                        </ul>
                                    </div><!-- /btn-group -->
                                    <input type="text" name="key" value="{$_GET['key']}" class="form-control" placeholder="输入关键字">
                                    <script>
                                        function setTab(type){
                                            $('#ip_type').val(type);
                                            if(type=="goods"){
                                                $('#search_type_title').html("商品");
                                            }else{
                                                $('#search_type_title').html("店铺");
                                            }
                                        }
                                    </script>
                                </div>
                            </form>
                        </ul>
                    </if>
                </div>
                <!-- /.navbar-collapse -->
            </div>
        </div>
    </nav>
</div>

<script>
    $('#sub_nav #tab_{$current}').addClass('active');
</script>